import { PORT2 } from '@/api/config/servicePort';
import http from '@/api';
import { UserInterface } from '@/api/interface/auth/user';
import { DictionariesInterface } from '@/api/interface/basic/dictionaries';
import { PublicParams } from '@/api/interface/publicParams';
/**
 * @name 数据字典
 */

// 修改状态
export const basicDataDictionaryUpdateStatus = (params: PublicParams.ReqStatus) => {
  return http.post(PORT2 + `/basicDataDictionary/v1/updateStatus`, params);
};

// 新增|编辑数据字典
export const basicDataDictionarySave = (params: DictionariesInterface.ReqSave) => {
  return http.post(PORT2 + `/basicDataDictionary/v1/save`, params);
};

// 查询字典
export const basicDataDictionaryList = (params: DictionariesInterface.ReqList) => {
  return http.post<DictionariesInterface.ResList[]>(PORT2 + `/basicDataDictionary/v1/list`, params);
};

// 查询字典(树结构)
export const basicDataDictionaryFindTreeList = () => {
  return http.post<DictionariesInterface.ResList[]>(PORT2 + `/basicDataDictionary/v1/list`);
};

// 查询平铺后字典
export const basicDataDictionaryFlattenTree = () => {
  return http.get<DictionariesInterface.ResList[]>(PORT2 + `/basicDataDictionary/v1/flattenTree`);
};

// 删除字典
export const basicDataDictionaryDelete = (params: PublicParams.ReqId) => {
  return http.get(PORT2 + `/basicDataDictionary/v1/delete/${params.id}`);
};
